//
// Created by zhku666 on 25-2-24.
//

#include <stdio.h>
#include <time.h>

void log(const char* message) {

    time_t now;
    char time_str[100];

    time(&now);
    strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S", localtime(&now));

    FILE* file = fopen("operation.txt", "a");
    if (file == NULL) {
        perror("打开文件失败\n");
        return;
    }
    fprintf(file, "[%s] %s\n", time_str, message);

    fclose(file);
}